package com.hualan.zhsq.controller.property;

import com.hualan.zhsq.entity.property.ProcessState;
import com.hualan.zhsq.service.property.ProcessStateService;
import com.hualan.zhsq.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName ProcessController
 * @Description TODO
 * @Author ZheRan
 * @Date 2025年08月04日 下午9:00
 * @Version 1.0
 */
@RestController
public class ProcessController {
    @Autowired
    private ProcessStateService processStateService;

    //新增一条数据
    @PostMapping("/process/add")
    public Result add(@RequestBody ProcessState processState){
        return Result.success(processStateService.add(processState));
    }

    //逻辑删除一条数据
    @DeleteMapping("/process/remove/{id}")
    public Result remove(@PathVariable Integer id){
        return Result.success(processStateService.remove(id));
    }

    //批量逻辑删除数据
    @DeleteMapping("/process/removeBatch")
    public Result removeBatch(@RequestBody Integer[] ids){
        return Result.success(processStateService.removeBatch(ids));
    }

    //修改一条数据
    @PutMapping("/process/edit")
    public Result edit(@RequestBody ProcessState processState){
        return Result.success(processStateService.edit(processState));
    }

    //根据id查询数据
    @GetMapping("/process/findById/{id}")
    public Result findById(@PathVariable Integer id){
        return Result.success(processStateService.findById(id));
    }

    //查询所有数据
    @GetMapping("/process/findPage")
    public Result findPage(){
        return Result.success(processStateService.findPage(1, 10, new ProcessState()));
    }
}
